package com.tm.pojo;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class PriceDate {
	Date date = null;
	Double price = Double.NaN;

	public PriceDate() {
	}
	public PriceDate(Price p) {
		date = p.getDate();
		price = p.getPrice();
	}
	public String getDate() {
		if (date == null) {
			return "no price history";
		} else {
			SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yy");
			return(dateFormat.format(date.getTime()));
		}
	}
	public String getPrice() {
		if (price.isNaN()) {
			return "NaN";
		} else {
			DecimalFormat df = new DecimalFormat("#0.0000");
	        return(df.format(price));
		}
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
}
